#ifndef MYGRAPHICELLIPSE_H
#define MYGRAPHICELLIPSE_H

#include "mylineedit.h"

#include <QWidget>
#include <QPainter>
#include <QPen>
#include <QMouseEvent>
#include <QVector>
#include <QPen>
#include <QTime>
#include <QLineEdit>

class MyGraphicEllipse : public QWidget
{
    Q_OBJECT

    QVector<int> lineIndexs;
    QPoint firstClick; // 鼠标首次点击的位置

    int radius;
    bool isSelected;
    QTime firstClickTime;
    MyLineEdit* edit;

public:
    explicit MyGraphicEllipse(QWidget *parent = nullptr);

    int getRadius();

    void addLineIndex(int index);
    QVector<int> getLineIndex();
    void setSelect(bool isSelected);
    void removeLineIndex(int index);

    void myMousePressEvent(QMouseEvent *event);
    void myMouseMoveEvent(QMouseEvent *event);
    void myMouseReleaseEvent(QMouseEvent *event);
protected:
    void paintEvent(QPaintEvent *event) override;
    bool event(QEvent *event) override;

signals:
    void signalMove(QVector<int> indexs);
    void signalSelectChange(MyGraphicEllipse* ellipse, bool select);

public slots:
};

#endif // MYGRAPHICELLIPSE_H
